package 笔试2.pdd.three;

import java.util.*;

/*
4
0 1 1 0

2 4 3 1
 */
//身高排序 前面有几个比自己矮的
public class Main {
    public static void main(String[] args) {
        int[] p = {0,1,1,0}; int N=4;
        Scanner sc = new Scanner(System.in);
        N=sc.nextInt();
        p=new int[N];
        for (int i = 0; i < N; i++) {
            p[i]=sc.nextInt();
        }
        Stack<Integer> stack = new Stack<>();
        for (int i = 0; i < p.length; i++) {
            if(stack.isEmpty()){
                stack.push(i);//索引栈
            }
            else{
                int k = stack.size()-p[i];
                Stack<Integer> tmp = new Stack<>();
                for (int j = 0; j < k; j++) {
                    tmp.push(stack.pop());
                }

                stack.push(i);

                while(!tmp.isEmpty()){
                    Integer top = tmp.pop();
                    stack.push(top);
                }

            }
        }

        int[] a = new int[stack.size()];
        int i=0;
        while(!stack.isEmpty()){
            a[a.length-1-i]=stack.pop();
            i++;
        }

        List<int[]> list =new ArrayList<>();
        for (int h=0;h<a.length;h++) {
            list.add(new int[]{h,a[h]});
        }
        Collections.sort(list, (o,b)->(o[1]-b[1]));

        int[] res = new int[list.size()];
        for (int j = 0; j < res.length; j++) {
            res[j]=list.get(j)[0]+1;
        }

        for (int j = 0; j < res.length; j++) {
            System.out.print(res[j]+" ");
        }

    }
}
